<template>
  <el-carousel height="720px" :interval="3000" arrow="always">
    <el-carousel-item v-for="item in banner_list" :key="item.id"> 
      <a :href="item.link"><img :src="item.image_url" alt=""></a>
    </el-carousel-item>
   
  </el-carousel>
</template>

<script>
export default {
  name: "BannerComp",
  data(){
    return {
      banner_list: []
    }
  },
  created(){
    this.get_banner_list()
  },
  methods: {
    // 请求后端api获取轮播图数据
    get_banner_list(){
     
      this.$axios.get(`${this.$settings.Host}/home/banner/`, {}).then(res=>{
        console.log(res.data)
        this.banner_list = res.data
      })
    }
    
  }
}
</script>

<style scoped>
.el-carousel,
.el-carousel__item {
  height: 690px;
}

.carousel-img {
  width: 100%;
  height: auto;
  object-fit: cover;
  margin: 0;
  padding: 0;
}
</style>